package com.rykj.qxj.server.dao;

import com.rykj.qxj.server.common.ZmanagerBaseMapper;
import com.rykj.qxj.server.model.entity.Apply;
import com.rykj.qxj.server.model.entity.ApplyApi;
import com.rykj.qxj.server.model.entity.ApplyRelateParty;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface ApplyManageMapper extends ZmanagerBaseMapper<Apply> {

     int  saveApply(Apply apply);
     List<Map<String,Object>> getAppApiVisitCount(@Param("applyId")String applyId, @Param("apiIds")String[] apiIds, @Param("dataType")String dataType);
     void saveApplyRelateParty(@Param("relateParties") List<ApplyRelateParty> relateParties);

     void saveApplyAccount(@Param("applyAccounts") List<Map<String, Object>> applyAccounts);

     void saveApplyCategorys(@Param("categorys") List<Map<String, Object>> categorys);

     void updateApply(Apply apply);

     void updateApplyRelateParty(ApplyRelateParty relateParty);

     void deleteApply(Integer applyId);

     List<Map<String,Object>> getApplys(Map<String, Object> paraMap);

     List<ApplyRelateParty> getApplyRelateParties(Integer applyId);

    Apply getApplyDetails(Map<String, Object> paraMap);

    List<Integer> getAccountIds(Integer applyId);

    List<Map<String, Object>> getApplyAPIs(Map<String, Object> paraMap);

    List<Map<String, Object>> getApplyInfo(Map<String, Object> paraMap);

    List<Map<String, Object>> getApplyUnboundAPIs(Map<String, Object> paraMap);
    
    List<Map<String, Object>> getApplyUnboundAndOutSideAPIs(Map<String, Object> paraMap);

    void saveApplyApi(@Param("applyApis") List<ApplyApi> applyApis);

    void deleteApplyApiById(Integer id);

    void updateApplyIssuance(Map<String, Object> paraMap);

	Apply selectApplyByAppKey(String appKey);

    Apply checkApplyRep(Map<String, Object> paraMap);

    List<Apply> findAllApplys(Map<String, Object> paraMap);
    // List<Map<String, Object>> getApplyAccounts(Integer applyId);
    
    Map<String,Object> applicationTotal();
    List<Apply> findApplysListByIssuance();
    
    Apply selectApplyByApplyId(String applyId);

    Integer getApiAppCount(Map<String, Object> paraMap);

    Integer getApplysCount(Map<String, Object> paraMap);
    
    Apply selectApplyByAppKeyIsExist(String applyKey);
    
    List<ApplyApi> selectCurrentApplyListByAppId(int applyId);
    
    Integer selectApiCountByApplyId(Integer applyId);
    
    Integer selectNewAddApplyNear7day();
    
    Integer selectCountApply();
    
    Integer selectCountOnlineApply();

    Integer selectCountNotOnlineApply();

    void deleteApplyAccount(Map<String, Object> account);

    Integer getAppTotal();
}
